package com.zengde.ai_sandbox.test.testthread.mathteacher;

public class DriverMathTeacher
{
    public static void main(String[] args) throws InterruptedException
    {

        MathTeacher  mathTeacher = new MathTeacher();

        //2个加线程
        for(int i=0;i<2;i++){
            new Thread(new Runnable() {
                @Override
                public void run() {
                    while (true){
                        mathTeacher.add();
                    }
                }
            }).start();
        }

        //2个减线程
     /*   for(int i=0;i<2;i++){
            new Thread(new Runnable() {
                @Override
                public void run() {
                    while (true){
                        mathTeacher.sub();
                    }
                }
            }).start();
        }*/




        for(int i=0;i<2;i++){
            new Thread(() -> {
                while (true){
                    mathTeacher.sub();
                }
            }).start();
        }
    }
}
